gint icon_size; /* icon size we are using */
GIcon *fallback_gicon;
+ StIconColors *colors;
+
CoglPipeline *shadow_pipeline;
StShadow *shadow_spec;
graphene_size_t shadow_size;
g_clear_object (&priv->gicon);
g_clear_object (&priv->fallback_gicon);
+ g_clear_pointer (&priv->colors, st_icon_colors_unref);
g_clear_pointer (&priv->shadow_pipeline, cogl_object_unref);
g_clear_pointer (&priv->shadow_spec, st_shadow_unref);
StIcon *self = ST_ICON (widget);
StThemeNode *theme_node = st_widget_get_theme_node (widget);
StIconPrivate *priv = self->priv;
+ gboolean should_update = FALSE;
+ g_autoptr(StShadow) shadow_spec = NULL;
+ StIconColors *colors;
- st_icon_clear_shadow_pipeline (self);
- g_clear_pointer (&priv->shadow_spec, st_shadow_unref);
-
- priv->shadow_spec = st_theme_node_get_shadow (theme_node, "icon-shadow");
+ shadow_spec = st_theme_node_get_shadow (theme_node, "icon-shadow");
- if (priv->shadow_spec && priv->shadow_spec->inset)
+ if (shadow_spec && shadow_spec->inset)
{
g_warning ("The icon-shadow property does not support inset shadows");
- st_shadow_unref (priv->shadow_spec);
- priv->shadow_spec = NULL;
+ g_clear_pointer (&shadow_spec, st_shadow_unref);
+ }
+
+ if ((shadow_spec && priv->shadow_spec && !st_shadow_equal (shadow_spec, priv->shadow_spec)) ||
+ (shadow_spec && !priv->shadow_spec) || (!shadow_spec && priv->shadow_spec))
+ {
+ st_icon_clear_shadow_pipeline (self);
+
+ g_clear_pointer (&priv->shadow_spec, st_shadow_unref);
+ priv->shadow_spec = g_steal_pointer (&shadow_spec);
+
+ should_update = TRUE;
+ }
+
+ colors = st_theme_node_get_icon_colors (theme_node);
+
+ if ((colors && priv->colors && !st_icon_colors_equal (colors, priv->colors)) ||
+ (colors && !priv->colors) || (!colors && priv->colors))
+ {
+ g_clear_pointer (&priv->colors, st_icon_colors_unref);
+ priv->colors = st_icon_colors_ref (colors);
+
+ should_update = TRUE;
}
priv->theme_icon_size = (int)(0.5 + st_theme_node_get_length (theme_node, "icon-size"));
- st_icon_update_icon_size (self);
- st_icon_update (self);
+
+ should_update |= st_icon_update_icon_size (self);
+
+ if (should_update)
+ st_icon_update (self);
}
static void